package com.xyx.bloodoxygenlib.impls;

import com.xyx.bloodoxygenlib.interfaces.IReader;
import com.xyx.bloodoxygenlib.operator.BLEOpertion;

import java.io.IOException;

public class BLEReader implements IReader {
    private BLEOpertion is;

    public BLEReader(BLEOpertion is) {
        this.is = is;
    }

    @Override // com.creative.base.Ireader
    public int read(byte[] buffer) throws IOException {
        if (this.is != null) {
            return this.is.read(buffer);
        }
        return 0;
    }

    @Override // com.creative.base.Ireader
    public void close() {
    }

    @Override // com.creative.base.Ireader
    public void clean() {
        if (this.is != null) {
            this.is.cleanData();
        }
    }

    @Override // com.creative.base.Ireader
    public int available() throws IOException {
        return this.is.available();
    }
}
